home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
050a.dms
/
050a.adf
/
TEXTS
/
chapter11.txt
< prev
next >
Wrap
Text File
|
1992-02-26
|
5KB
|
165 lines
The Absolute Beginners Guide To Amos
-------------------------------------
Chapter eleven
--------------
I think it`s high time we took a closer look at memory banks.
EXAMPLE11.Amos listed below, is a mini slide show with music program.
REM Mini slideshow with fades and music
'--------------------------------------
HIDE: TRACK LOOP ON: TRACK PLAY 5
BEGIN:
UNPACK 12 TO 0
WAIT 400
FADE 5
WAIT 75
UNPACK 11 to 0
WAIT 400
FADE 1
WAIT 15
UNPACK 10 TO 0
WAIT 400
FADE 10
WAIT 150
GOTO BEGIN
Hold on! Where are the LOAD IFF and TRACK LOAD commands for the pictures and
music? The answer is, we don`t need them, because the pictures and music
are already stored inside the program, in memory banks. First I will explain
about the music. Imagine you have just loaded up Amos and you are sitting in
front of the blank editor. Press escape to go into direct mode, now type in:
TRACK LOAD "DF0:MUSIC/MOD.FUN",5
This is the same line that we would normally use in a program to LOAD the
the music. Obviously you can change the name of the file you want to load
from MOD.FUN to that of your choice.
The music is now stored in bank five. Staying in Direct mode type:
TRACK PLAY 5
and you will now hear the music play.
When you save the program the contents of any permanent memory bank in use is
saved along with the basic listing and when you reload it the music will
still be there in bank five. So a simple, TRACK PLAY 5, will start it again.
There are certain types of banks that are not saved along with the program
but we are not concerned with that at the moment as we are concentrating on
music and pictures.
The pictures use the same technique. When I wrote the Mini Slideshow program
I loaded the music into bank five as described then I loaded a picture from
disk into the default screen (0) like this:
LOAD IFF "DF0:PICS/SONIC.IFF",0
The same as we would inside a program, but staying in direct mode.
I then typed the magical command:
SPACK 0 to 10
Which tells Amos to sPACK the picture currently in screen 0 and store a
compressed copy of it in bank ten. I repeated this for two more pictures
LOADing them into screen 0 and then SPACKing them into banks 11 and 12.
I then typed:
LISTBANK
to check the banks were there and then returned to the blank editor to save
the blank program listing off which automatically saved the banks along with
it. To display a SPACKed picture from a bank we use the command:
UNPACK bank TO screen
So if for example we had a picture stored in bank 7 and we wanted to UNPACK
it to the default screen we would use:
UNPACK 7 TO 0
And that is all there is to it. The benefits of SPACKING pictures are that
because they are packed they use up less memory and disk space, keep the
program listing free of LOAD commands and no slow disk access is required.
Note: When you UNPACK a picture it does not erase the bank so you can keep
UNPACKING as many copies of the picture as you need. If you do need or
want to delete the picture from the bank just use ERASE bank number.
For example, ERASE 10, and the memory previously used by that bank
should be returned for use to your program.
Note2: Amos automatically uses the palette of any picture you unpack in case
you were wondering!
So to the program breakdown:
HIDE: TRACK LOOP ON: TRACK PLAY 5
----------------------------------
Hide the mouse pointer to keep things tidy. Set the music to LOOP.
PLAY the music that is stored in bank five.
BEGIN:
------
A label (or marker if you like) for GOTO to - GO TO .
UNPACK 12 TO 0
--------------
Unpack the previously SPACKED picture from bank 12 to screen 0.
WAIT 400
--------
WAIT eight seconds to give the user time to view the picture.
FADE 5
------
Literally FADEs the screen to black, try different values if you like.
WAIT 75
-------
This WAIT is necessary to give the FADE enough time to finish, you can
work out the exact timing by using FADE speed*15 (5*15=75)
UNPACK 11 to 0
--------------
Unpack the picture in bank 11 to screen 0.
WAIT 400
--------
Wait 8 seconds.
FADE 1
------
Try a different fade.
WAIT 15
-------
WAIT 1*15
UNPACK 10 TO 0
--------------
Unpack bank 10 to screen 0.
WAIT 400
--------
Guess!
FADE 10
-------
FADE it out.
WAIT 150
--------
Give the FADE time to do it`s job.
GOTO BEGIN
----------
Jump to the line marked LABEL and start unpacking the pics again.
As a bit of homework why not change the pictures, music and FADEs?
Try changing the WAIT N to, CLEAR KEY: WAIT KEY, so the user can view the
picture as long as he/she wants to.
End of chapter eleven
^^^^^^^^^^^^^^^^^^^^^